package com.sysd.mail.smtp;

import com.sysd.mail.smtp.command.*;


/**
 * project: mail
 *
 * @author bsh
 * @description SmtpCommandFactory
 * @dataTime 2023/3/28 8:58
 * @company 丽水信阳软件科技有限公司
 */
public enum    SmtpCommandFactory {
    /**
     * 命令枚举
     */
    EHLO(new EhloCommand(),false),
    DATA(new DataCommand(),false),
    MAIL(new MailCommand(),false),
    NOOP(new NoopCommand(),false),
    QUIT(new QuitCommand(),false),
    RCPT(new RcptCommand(),false),
    REST(new RestCommand(),false)
    ;

    SmtpCommandFactory(SmtpCommand command, boolean isLogin) {
        this.command = command;
        if(isLogin){
            this.command = new RequireAuthCommandWrapper(this.command);
        }
    }

    private SmtpCommand command;
    private boolean isLogin;

    public SmtpCommand getCommand() {
        return command;
    }

    public void setCommand(SmtpCommand command) {
        this.command = command;
    }

    public boolean isLogin() {
        return isLogin;
    }

    public void setLogin(boolean login) {
        isLogin = login;
    }
}
